package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsSign;
import com.yidu.ruifeng_logistics.dao.LogisticsSignDao;
import com.yidu.ruifeng_logistics.service.LogisticsSignService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (LogisticsSign)表服务实现类
 *
 * @author makejava
 * @since 2021-03-09 14:29:15
 */
@Service("logisticsSignService")
public class LogisticsSignServiceImpl implements LogisticsSignService {
    @Resource
    private LogisticsSignDao logisticsSignDao;

    /**
     * 通过ID查询单条数据
     *
     * @param signId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsSign queryById(Integer signId) {
        return this.logisticsSignDao.queryById(signId);
    }

    @Override
    public List<LogisticsSign> queryByOrderId(Integer orderId) {
        return this.logisticsSignDao.queryByOrderId(orderId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsSign> queryAllByLimit(int offset, int limit) {
        return this.logisticsSignDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsSign 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsSign insert(LogisticsSign logisticsSign) {
        this.logisticsSignDao.insert(logisticsSign);
        return logisticsSign;
    }

    /**
     * 修改数据
     *
     * @param logisticsSign 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsSign update(LogisticsSign logisticsSign) {
        this.logisticsSignDao.update(logisticsSign);
        return this.queryById(logisticsSign.getSignId());
    }

    /**
     * 通过主键删除数据
     *
     * @param signId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer signId) {
        return this.logisticsSignDao.deleteById(signId) > 0;
    }

    @Override
    public List<LogisticsSign> queryAll(LogisticsSign logisticsSign) {
        return this.logisticsSignDao.queryAll(logisticsSign);
    }

}
